Repository navigation
Conversation
yefuyou
marked this pull request as ready for review
December 5, 2026 15:25
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #509
Summary
Adds regression tests and an explanatory comment for the empty-dispatch Agent lease case. The code fix itself is already on
main: the #381 refactor (b9b7e587) movedstart_agent_session()inConversations.dispatch()to after thepending is Nonecheck, so an empty queue no longer creates an orphanagent:session row. This branch originally carried the same fix; after syncing withmainonly the items below remain.Root cause (for reference)
Before the fix,
run_chain()calledConversations.dispatch()after a successful turn, anddispatch()started a project Agent session before checking for a queued message. With no queued message it returned without any turn owning the new session, leaving an orphanagent:row until lease expiry. That row could make project rename, deletion or cleanup be rejected as if another window had the project open.What this PR changes relative to
mainapps/api/src/opendirector_api/agent.py: a comment above the existingstart_agent_session(...)call indispatch()stating that the lease is taken only once a queued message exists. No behavior change.tests/test_assistant_dispatch_lease.py: 5 regression tests:No queue ordering, turn execution or #381 admission-lock behavior is changed.
Verification
main(confirming the fix is already there). With the fix reverted in a scratch copy, 3 of them fail (single turn, queue order, late-queued message); the Stop and rollback tests guard existing behavior and do not catch that revert.test_assistant_dispatch_lease.py+test_ci_layers.py28 passed;lint-imports4 contracts kept. The wider assistant/agent set has 4 failures that also fail on cleanmain(ffmpeg missing in the sandbox).coreshard (check_test_layers.py --list-shard corelists it).6fff3d08: 17/17 passed.Related: #381, #379, #502.